import service from "@/utils/request";
import type {
  TrademarkModel,
  RecordsModel,
  ItrademarkModelList,
} from "./model/trademarkModel";

enum Api {
  getTrademarkListUrl = "/admin/product/baseTrademark",
  deleteTrademarkUrl = "/admin/product/baseTrademark/remove",
  addTrademarkUrl = "/admin/product/baseTrademark/save",
  updataTrademarkUrl = "/admin/product/baseTrademark/update",
  getAllTrademarkListUrl = "/admin/product/baseTrademark/getTrademarkList",
}

// 品牌列表
export const reqTrademarkList = (page: number, limit: number) => {
  return service.get<any, TrademarkModel>(
    `${Api.getTrademarkListUrl}/${page}/${limit}`
  );
};

// 删除单个品牌数据
export const deleteTrademarkApi = (id: number) => {
  return service.delete<any, null>(`${Api.deleteTrademarkUrl}/${id}`);
};

// 添加单个品牌数据
export const addTrademarkItemApi = (banner: RecordsModel) => {
  return service.post<any, null>(Api.addTrademarkUrl, banner);
};

// 修改单个品牌数据
export const updataTrademarkApi = (baseTrademark: RecordsModel) => {
  return service.put<any, null>(Api.updataTrademarkUrl, baseTrademark);
};

// 获取所有商品列表
export const getAllTrademarkListApi = () => {
  return service.get<any, ItrademarkModelList>(Api.getAllTrademarkListUrl);
};
